package src.simple_utils;

import java.util.*;
import java.lang.*;

public class DequeUsage {
    public static void main(String[] args) {
        //    ArrayDeque: 基于数组实现的线性双向队列，通常作为栈或队列使用，但是栈的效率不如LinkedList高。队列
        Deque<Integer> queue = new ArrayDeque<>();
        queue.addLast(1);
        queue.offerLast(2);
        queue.addFirst(3);

        System.out.println(queue);

        //    LinkedList: 基于链表实现的链式双向队列，通常作为栈或队列使用，但是队列的效率不如ArrayQueue高。栈
        Deque<Integer> stack = new LinkedList<>();
        stack.addLast(1);
        stack.offerLast(2);
        stack.addFirst(3);
        System.out.println(stack);

        List<Integer> list = new Vector<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        System.out.println("list = " + list);
        List<Integer> oflist = List.of(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
        System.out.println("oflist = " + oflist);
        System.out.println("Math.max(list.get(1), list.get(2)) = " + Math.max(list.get(1), list.get(2)));


        Set<Integer> set = new LinkedHashSet<>();
        Set<Integer> ofset = new HashSet<>(Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15));
        Set<Integer> TreeSet = new TreeSet<>();
        ofset.add(16);


    }

}
